package site.jlopen;

import java.net.InetAddress;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

@SpringBootApplication
@MapperScan({ "site.jlopen.dao", "site.jlopen.mapper" })
@EnableScheduling
@EnableAsync
@Slf4j
public class KusciaUiApp {
	
	@SneakyThrows
	public static void main(String[] args) {
		SpringApplication app = new SpringApplication(KusciaUiApp.class);
		ConfigurableApplicationContext application = app.run(args);
		Environment env = application.getEnvironment();
		log.info(
				"\n----------------------------------------------------------\n\t"
				+ "Kuscia Ui '{}' is running! Access URLs:\n\t" 
				+ "Local: \t\thttp://localhost:{}\n\t"
				+ "External: \thttp://{}:{}\n\t" + "Doc: \thttp://{}:{}/doc.html\n"
				+ "----------------------------------------------------------",
				env.getProperty("spring.application.name"), env.getProperty("server.port"),
				InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"),
				InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"));
	}
}
